package com.swm.yzgrtk.utils;

/**
 * @author 师文明
 * @data 2025/2/27 下午4:34
 **/
public class GpsUtil {
    public static double[] getGPSData(String j, String w) {
        double[] LanLon = new double[2];
        try {
            String jingdu = j.split("\\.")[0].substring(0, j.split("\\.")[0].length() - 2);
            String minutes = j.split("\\.")[0];
            double dec_jingdu = (((Double.parseDouble(j) -
                    Double.parseDouble(j.split("\\.")[0])) * 60 / 3600 + (Double
                    .parseDouble(minutes.substring(minutes.length() - 2)) / 60)));
            String weidu = w.split("\\.")[0].substring(0, w.split("\\.")[0].length() - 2);
            String weidu_minutes = w.split("\\.")[0];
            double dec_weidu = (((Double.parseDouble(w) -
                    Double.parseDouble(w.split("\\.")[0])) * 60 / 3600 + (Double
                    .parseDouble(weidu_minutes.substring(weidu_minutes.length() - 2)) / 60)));
            LanLon[0] = (Double.parseDouble(jingdu) + dec_jingdu);
            LanLon[1] = (Double.parseDouble(weidu) + dec_weidu);

        } catch (Exception e) {
            e.printStackTrace();
        }
        return LanLon;
    }

}
